package Messages;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;

import client.LibaryMain;

import com.mysql.jdbc.PreparedStatement;

import ocsf.server.ConnectionToClient;
import server.SQLConnection;
/**
 * this class implements the updating email in db
 * @author Ron Shenkerman
 * @author Gabi Revah
 * @author Aviad Almog
 * @author Ivan Onyshchenko
 */
public class MessageNewEmail {

	/**
	 * constractor of this class 
	 * @param client
	 */
	public MessageNewEmail() {
		super();
		
	}
	/**
	 * editing new email to the DB 
	 * @param str
	 * @throws SQLException
	 * @throws IOException
	 */

	public String editmail(String[] str) throws SQLException, IOException {
		
		
			SQLConnection sc = new SQLConnection();
			java.sql.PreparedStatement ps = sc.getConnection().prepareStatement("Update DB1.subscriber SET email=? WHERE ID=?");// "UPDATE Messages SET description = ?, author = ? WHERE id = ? AND seq_num = ?");	
			ps.setString(1, str[2]);
			ps.setString(2, str[1]);
			ps.executeUpdate();
			
			String str1 = "NewEmail";
			ps.close();
			
			return str1;
			
			
		
		
		
		
		
		
		
		// TODO Auto-generated method stub
		
	}



}
